package com.itshizhan.designpattern.prototype.framework;

import java.util.HashMap;

/**
 * Client 使用者
 * 负责使用复制实例的方法生成新的实例
 * Manager类中不能出现ConcretePrototype,但可以出现Prototype
 * 即Manager类是连接Prototype与ConcretePrototype的桥梁
 */
public class Manager {
    private HashMap showCase = new HashMap();
    public void register(String name,Product proto){
        showCase.put(name,proto);
    }
    public Product create(String protoName){
        Product p = (Product) showCase.get(protoName);
        return p.createClone();
    }
}
